]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
windowManager: Use new reorder_workspace() API
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 8 Jul 2019 22:11:06 +0000 (00:11 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 9 Jul 2019 12:41:35 +0000 (14:41 +0200)
With the new Mutter API, inserting a workspace at a particular position
becomes as easy as creating the workspace and moving it to the desired
index.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/620

js/ui/windowManager.js

index 6ff952da7b30b3c4fa360f3cae0faecd8d68c65c..9322569f75a25d58cbeb35306647cb5c4dc5bc0b 100644 (file)
@@ -1203,41 +1203,9 @@ var WindowManager = class {
         if (!Meta.prefs_get_dynamic_workspaces())
             return;
 
-        workspaceManager.append_new_workspace(false, global.get_current_time());
-
-        let windows = global.get_window_actors().map(a => a.meta_window);
-
-        // To create a new workspace, we slide all the windows on workspaces
-        // below us to the next workspace, leaving a blank workspace for us
-        // to recycle.
-        windows.forEach(window => {
-            // If the window is attached to an ancestor, we don't need/want
-            // to move it
-            if (window.get_transient_for() != null)
-                return;
-            // Same for OR windows
-            if (window.is_override_redirect())
-                return;
-            // Sticky windows don't need moving, in fact moving would
-            // unstick them
-            if (window.on_all_workspaces)
-                return;
-            // Windows on workspaces below pos don't need moving
-            let index = window.get_workspace().index();
-            if (index < pos)
-                return;
-            window.change_workspace_by_index(index + 1, true);
-        });
-
-        // If the new workspace was inserted before the active workspace,
-        // activate the workspace to which its windows went
-        let activeIndex = workspaceManager.get_active_workspace_index();
-        if (activeIndex >= pos) {
-            let newWs = workspaceManager.get_workspace_by_index(activeIndex + 1);
-            this._blockAnimations = true;
-            newWs.activate(global.get_current_time());
-            this._blockAnimations = false;
-        }
+        let newWs = workspaceManager.append_new_workspace(
+            false, global.get_current_time());
+        workspaceManager.reorder_workspace(newWs, pos);
     }
 
     keepWorkspaceAlive(workspace, duration) {